"""
Simple example of using the recommendation engine
"""

from core.recommender import CompanionRecommender

def main():
    print("=" * 50)
    print("Companion Recommendation System - Example")
    print("=" * 50)
    
    # Initialize recommender
    print("\n[1] Initializing recommender...")
    recommender = CompanionRecommender(data_dir="data")
    
    # Example 1: Home recommendations for a new user
    print("\n[2] Getting recommendations for new user...")
    results = recommender.recommend_home(user_id=9999, page_size=5)
    
    print(f"\nTop 5 Recommendations:")
    print("-" * 50)
    for i, player in enumerate(results, 1):
        print(f"{i}. {player['nickname']}")
        print(f"   Price: ¥{player['price']} | Rating: {player['rating']} | Games: {', '.join(player['games'][:2])}")
    
    # Example 2: Game-specific recommendations
    print("\n[3] Getting recommendations for '王者荣耀'...")
    game_results = recommender.recommend_by_game(
        user_id=9999,
        game_id=1,  # 1=王者荣耀
        page_size=3
    )
    
    print(f"\nTop 3 '王者荣耀' Companions:")
    print("-" * 50)
    for i, player in enumerate(game_results, 1):
        print(f"{i}. {player['nickname']} - ¥{player['price']}")
    
    # Example 3: Similar companions
    print("\n[4] Finding similar companions to player 1001...")
    similar = recommender.recommend_similar(player_id=1001, count=3)
    
    print(f"\nSimilar Companions:")
    print("-" * 50)
    for i, player in enumerate(similar, 1):
        print(f"{i}. {player['nickname']} (similarity: {player['similarity_score']:.2f})")
    
    print("\n" + "=" * 50)
    print("Example complete!")
    print("=" * 50)

if __name__ == "__main__":
    main()

